<!DOCTYPE html>
<html>
<head>
    <title>后台</title>
    <meta charset="utf-8">
    <!-- public -->
    <link rel="stylesheet" href="<?=HW_CSS?>bootstrap/css/bootstrap.min.css"> 
    <link rel="stylesheet" href="<?=HW_CSS?>base.css"> 
    <link rel="stylesheet" href="<?=HW_CSS?>font.css">
    <link rel="stylesheet" href="<?=HW_CSS?>style.css">
    <link rel="stylesheet" type="text/css" href="<?=HW_CSS?>main_content.css">
    <style type="text/css">
        input, textarea, select { background: #f4f4f4!important; border: none!important; outline: none!important; box-shadow: none!important; }
        input[disabled], select[disabled] { background: #f4f4f4!important; cursor: default!important; }
    </style>
</head>
<body data-name="Contract">

    <form class="form-horizontal" action="" method="POST">

        <main style="margin-top: 0">
            <ul class="nav nav-tabs" role="tablist">
                <li role="presentation" class="active"><a href="##" data-id="base_info">基本信息</a></li>
                <li role="presentation"><a href="##" class="hide" data-id="clause_account" id="clause_account_nav">账款条款</a></li>
                <li role="presentation"><a href="##" data-id="aggrement_account">合同附件</a></li>
            </ul>

            <!-- Tab panes -->
            <div class="tab-content container" style="margin-left: 0">

                <!-- 基本信息内容区域 -->
                <div class="tab-pane active" id="base_info">

                    <!-- 签约编号、合作方式 -->
                    <div class="form-group">
                        <label class="col-sm-2 control-label">签约编号<span>*</span>：</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" name="contract_code" required value="<?=isset($contract)?$contract['contract_code']:''?>">
                        </div>

                        <label class="col-sm-2 control-label">合作方式<span>*</span>：</label>
                        <div class="col-sm-3">
                            <!-- <input type="text" class="form-control must" name="cooperation_type" required value="<?=isset($contract)?$contract['cooperation_type']:''?>"> -->
                            <select name="cooperation_type" class="form-control must" required>
                                <option value="0" <?if(isset($contract)){if($contract['cooperation_type']==0){echo "selected";}}else{echo "selected";}?>>固定租金</option>
                                <option value="1" <?if(isset($contract)){if($contract['cooperation_type']==1){echo "selected";}}else{echo "selected";}?>>税前销售额扣点</option>
                                <option value="2" <?if(isset($contract)){if($contract['cooperation_type']==2){echo "selected";}}else{echo "selected";}?>>固定租金两者取高</option>
                            </select>
                        </div>
                    </div>

                    <!-- 商户、项目  -->
                    <div class="form-group">
                        
                        <label class="col-sm-2 control-label">项目<span>*</span>：</label>
                        <div class="col-sm-3">

                            <select name="project_id" class="form-control must" id="own_project" required>
                                <?if(isset($project)):?>
                                <?foreach($project as $key=>$value):?>
                                    <option value="<?=$value['project_id']?>" <?if(isset($contract)){if($contract['project_id']==$value['project_id']){echo "selected";}}?>>[<?=$value['project_code']?>]<?=$value['project_name']?></option>
                                <?endforeach;?>
                                <?endif;?>
                            </select>

                        </div>

                        <label class="col-sm-2 control-label">商户<span>*</span>：</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control search_cont must" data-type="1" id="search-man" required readonly value="<?=isset($contract)?$contract['business_name']:''?>">
                            <input type="hidden" name="business_id" id="business_id" value="<?=isset($contract)?$contract['business_id']:''?>">
                            <span class="glyphicon glyphicon-search form-control-feedback"></span>
                        </div>

                    </div>

                    <!-- 业态、核算楼层  -->
                    <div class="form-group">

                        <label class="col-sm-2 control-label">核算楼层<span>*</span>：</label>
                        <div class="col-sm-3">
                            <select name="floor_id" class="form-control must" id="own_project" required>
                                <?if(isset($floor)):?>
                                <?foreach($floor as $key=>$value):?>
                                    <option value="<?=$value['floor_id']?>" <?if(isset($contract)){if($contract['floor_id']==$value['floor_id']){echo "selected";}}?>>[<?=$value['floor_code']?>]<?=$value['floor_name']?></option>
                                <?endforeach;?>
                                <?endif;?>
                            </select>
                        </div>

                        <label class="col-sm-2 control-label">品牌：</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" name="brand" value="<?=isset($contract)?$contract['brand']:''?>">
                        </div>

                    </div>

  
                    <!-- 选择场地 -->
                    <div class="form-group">
                        <label class="col-sm-2 control-label">选择场地<span>*</span>：</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control search_cont" readonly required id="search-place" value="<?=isset($contract)?$contract['placeMsg']:''?>">
                            <?if(isset($contract)):?>
                            <?foreach($contract['place_id'] as $key=>$value):?>
                                <input type="hidden" name="place_id[]" value="<?=$value?>">
                            <?endforeach;?>
                            <?endif;?>
                            <span class="glyphicon glyphicon-search form-control-feedback"></span>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">面积<span>*</span>：</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" name="size" value="<?=isset($contract)?$contract['size']:''?>">
                        </div>

                        <label class="col-sm-2 control-label">位置：</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" name="position" value="<?=isset($contract)?$contract['position']:''?>">
                        </div>
                    </div>



                    <!-- 起始日期、结束日期 -->
                    <div class="form-group">
                        <label class="col-sm-2 control-label">起始日期<span>*</span>：</label>
                        <div class="col-sm-3">
                            <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="form-control must" name="start_time" required value="<?=isset($contract)?$contract['start_time']!=0?date('Y-m-d',strtotime($contract['start_time'])):'':''?>">

                        </div>

                        <label class="col-sm-2 control-label">结束日期<span>*</span>：</label>
                        <div class="col-sm-3">
                            <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="form-control must" name="end_time" required value="<?=isset($contract)?$contract['end_time']!=0?date('Y-m-d',strtotime($contract['end_time'])):'':''?>">
                        </div>
                    </div>


                    <!-- 对方签约人、签约日期  -->
                    <div class="form-group">
                        <label class="col-sm-2 control-label">对方签约人<span>*</span>：</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control must" name="contract_name" required value="<?=isset($contract)?$contract['contract_name']:''?>">

                        </div>

                        <label class="col-sm-2 control-label">签约日期<span>*</span>：</label>
                        <div class="col-sm-3">
                            <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="form-control must" name="contract_time" required value="<?=isset($contract)?$contract['contract_time']!=0?date('Y-m-d',strtotime($contract['contract_time'])):'':''?>">
                        </div>
                    </div>


                    <!-- 对方签约人、签约日期  -->
                    <div class="form-group">

                        <label class="col-sm-2 control-label">业务员<span>*</span>：</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control must" value="<?=isset($contract)?$contract['operator_name']:$_SESSION['admin_info']['name']?>" required readonly>

                        </div>
                    </div>

                    <!-- 说明 -->
                    <div class="form-group">
                        <label class="col-sm-2 control-label">说明：</label>
                        <div class="col-sm-8">
                            <textarea class="form-control" name="note" rows="3"><?=isset($contract)?$contract['note']:''?></textarea>
                        </div>

                    </div>

                    <!-- 变更记录 -->
                    <div class="panel-group">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h4 class="panel-title">
                                    <a role="button" data-toggle="collapse" href="#collapseSeven">
                                        变更记录
                                    </a>
                                </h4>
                            </div>
                            <div id="collapseSeven" class="panel-collapse collapse in">
                               <div class="panel-body">
                                
                                <?if($contract_id != 0):?>
                                    <a class="new_iframe" href="<?=base_url().'Log/Log/seeLogList/place_contract/'.$contract_id?>">查看变更记录</a>
                                <?endif;?>  
                                               
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 账款条款 -->
                <div class="tab-pane" id="clause_account">
                <?if(isset($contract) && isset($contract['clause'])):?>
                <?foreach($contract['clause'] as $key=>$value):?>
                    <div class="bordered clause_account_item">
                        <div class="opt-del-icon">×</div>
                        
                        <input type="hidden" name="clause_clausetype_<?=($key+1)?>" value="<?=$value['clausetype']?>">
                        
                        <!-- 账款名称 、选中科目-->
                        <div class="form-group">
                            <label class="col-sm-2 control-label">账款名称<span>*</span>：</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control must" name="clause_name_<?=($key+1)?>" readonly required value="<?=$value['name']?>">
                            </div>

                            <label for="project_name" class="col-sm-2 control-label">选择科目<span>*</span>：</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control select_subject search-cont search_subject" data-type="0" name="select_subject_<?=($key+1)?>" data-num="<?=($key+1)?>" required readonly value="<?=$value['subjectMsg']?>">
                                <input type="hidden" name="clause_subject_<?=($key+1)?>" value="<?=$value['subject']?>">
                                <span class="glyphicon glyphicon-search form-control-feedback"></span>

                            </div>
                        </div>


                        <!-- 账款类型  -->
                        <div class="form-group">
                            <label for="project_name" class="col-sm-2 control-label">账款类型<span>*</span>：</label>
                            <div class="col-sm-3 form_text use_way">
                                <?if($value['subject_use_way']==1){echo '冲扣提成';}elseif($value['subject_use_way']==2){echo '租金';}elseif($value['subject_use_way']==3){echo '销售提成';}elseif($value['subject_use_way']==4){echo '固定费用';}elseif($value['subject_use_way']==5){echo '销售返额';}elseif($value['subject_use_way']==6){echo '临时费用';}elseif($value['subject_use_way']==7){echo '预存款';}else{echo '保证金';}?>
                            </div>

                            <label for="project_total_name" class="col-sm-2 control-label">收付方向：</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control pay_tword_<?=($key+1)?>" readonly value="<?=$value['getpay']==0?'收':'付'?>">
                                <input type="hidden" name="clause_getpay_<?=($key+1)?>" value="<?=$value['getpay']?>">
                            </div>
                        </div>


                        <!-- 开具发票、税收 -->
                        <div class="form-group">
                            <label for="project_name" class="col-sm-2 control-label">开具发票：</label>
                            <!-- <div class="col-sm-3">
                                <input type="checkbox" name="_<?=($key+1)?>">
                            </div> -->

                            <div class="col-sm-3 checkbox">
                                <label>
                                    <input type="checkbox" name="clause_invoice_<?=($key+1)?>" value="1" <?if($value['invoice']==1){echo "checked";}?>>
                                </label>
                            </div>

                            <label for="project_name" class="col-sm-2 control-label">税收：</label>
                            <div class="col-sm-3">
                                <select class="form-control tax" name="clause_tax_<?=($key+1)?>">
                                    <option value="0" <?if($value['tax']==0){echo "selected";}?>>价外税5%</option>
                                    <option value="1" <?if($value['tax']==1){echo "selected";}?>>价外税6%</option>
                                    <option value="2" <?if($value['tax']==2){echo "selected";}?>>价外税0%</option>
                                    <option value="3" <?if($value['tax']==3){echo "selected";}?>>价外税11%</option>
                                    <option value="4" <?if($value['tax']==4){echo "selected";}?>>价外税13%</option>
                                    <option value="5" <?if($value['tax']==5){echo "selected";}?>>价内税17%</option>
                                    <option value="6" <?if($value['tax']==6){echo "selected";}?>>价内税5%</option>
                                    <option value="7" <?if($value['tax']==7){echo "selected";}?>>价内税6%</option>
                                    <option value="8" <?if($value['tax']==8){echo "selected";}?>>价内税11%</option>
                                    <option value="9" <?if($value['tax']==9){echo "selected";}?>>价内税13%</option>
                                </select>
                            </div>
                        </div>


                        <div class="little_title">结算周期</div>
                    
                        <!-- 名称、出账日类型 -->
                        <div class="form-group">
                            <label class="col-sm-2 control-label">名称<span>*</span>：</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control must" required name="clause_cyclename_<?=($key+1)?>" value="<?=$value['cyclename']?>">
                            </div>
                        </div>
                        <div class="hide">
                            <label class="col-sm-2 control-label">出账日类型：</label>
                            <div class="col-sm-3">
                                <select class="form-control" name="clause_out_accounts_<?=($key+1)?>">
                                    <option value="0" <?if($value['out_accounts']==0){echo "selected";}?>>固定日</option>
                                </select>
                            </div>
                        </div>

                        <!-- 周期类型、周期月数  -->
                        <div class="form-group hide">
                            <label for="project_name" class="col-sm-2 control-label">周期类型：</label>
                            <div class="col-sm-3">
                                <select class="form-control" name="clause_type_<?=($key+1)?>">
                                    <option value="0" <?if($value['type']==0){echo "selected";}?>>自然月</option>
                                    <option value="1" <?if($value['type']==1){echo "selected";}?>>合同月</option>
                                </select>
                            </div>

                            <label for="project_total_name" class="col-sm-2 control-label">周期月数<span>*</span>：</label>
                            <div class="col-sm-3">
                                <!-- <input type="number" min="0" class="form-control" name="clause_month_<?=($key+1)?>" required digist min="1" max="12" value="<?=$value['month']?>"> -->
                                <input type="number" min="0" class="form-control" name="clause_month_<?=($key+1)?>" required digist min="1" max="12" value="1">
                            </div>
                        </div>

                        <!-- <div class="row">
                            <label class="col-sm-2 control-label">最后缴款日期</label>
                        </div><hr> -->

                        <!-- 起算日类型  -->
                        <div class="form-group hide">
                            <label for="project_name" class="col-sm-2 control-label">起算日：</label>
                            <div class="col-sm-3">
                                <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="form-control" name="clause_start_type_<?=($key+1)?>" value="<?=$value['start_type']!=0?date('Y-m-d',strtotime($value['start_type'])):'2011-10-12'?>">
                            </div>

                            <!-- <label for="project_name" class="col-sm-2 control-label">起算日<span>*</span>：</label>
                            <div class="col-sm-3 clearFixed">
                                <div class="col-sm-6">
                                    <input type="number" min="0" class="form-control must" name="clause_start_month_<?=($key+1)?>" required digist min="0" max="12" value="<?=$value['start_month']?>">
                                </div>
                                <div class="col-sm-6">
                                    <input type="number" min="0" class="form-control must" name="clause_start_days_<?=($key+1)?>" required digist min="0" max="31" value="<?=$value['start_days']?>">
                                </div>
                            </div> -->
                        </div>


                        <!-- 日固定金额  -->
                        <div class="form-group hide">
                            <label for="project_name" class="col-sm-2 control-label">日固定金额<span>*</span>：</label>
                            <div class="radio form-radio">
                                <label>
                                    <input type="radio" class="must" name="clause_day_type_<?=($key+1)?>" value="0" required <?if($value['day_type']==0){echo "checked";}?>> 按日计算
                                </label>
                            </div>
                           
                            <div class="radio form-radio"">
                                <label>
                                    <input type="radio" class="must" name="clause_day_type_<?=($key+1)?>"  value="1" required <?if($value['day_type']==1){echo "checked";}?>> 按年计算
                                </label>
                            </div>
                        </div>


                       <div class="form-group">
                            <label class="col-sm-2 control-label">账款新增：</label>

                            <div class="col-sm-10">
                                <table class="table table-bordered">
                                    <thead>
                                        <tr>
                                            <th class="col-4">行号</th>
                                            <th class="col-10">起始日期</th>
                                            <th class="col-10">截止日期</th>
                                            <!-- if (clausetype == '1') way = '面积单价';
                                                if (clausetype == '2') way = '月面积单价';
                                                if (clausetype == '3') way = '日金额';
                                                if (clausetype == '4') way = '时段总金额';
                                                if (clausetype == '5') way = '税前销售额扣点（%）';
                                                if (clausetype == '6') way = '税前销售额扣点（%）'; -->
                                            <th class="col-10"><?if($value['clausetype']==1){echo '面积单价';}elseif($value['clausetype']==2){echo '月面积单价';}elseif($value['clausetype']==3){echo '日金额';}elseif($value['clausetype']==4){echo '时段总金额';}else{echo '税前销售额扣点（%）';}?></th>
                                            <th class="col-5 <?if($value['clausetype']!=6){echo 'hide';}?>">固定租金</th>
                                            <th> </th>                
                                        </tr>
                                    </thead>

                                    <tbody class="clause_tr_tem">
                                    <?if(is_array($value['new_clause'])):?>
                                    <?foreach($value['new_clause'] as $k=>$v):?>
                                        <tr>
                                            <td><?=($k+1)?></td>
                                            <td><input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="clause_new_start_time_<?=($key+1)?>_<?=($k+1)?>" value="<?=$v[0]!=0?date('Y-m-d',strtotime($v[0])):''?>"></td>
                                            <td><input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="clause_new_end_time_<?=($key+1)?>_<?=($k+1)?>" value="<?=$v[1]!=0?date('Y-m-d',strtotime($v[1])):''?>"></td>
                                            <td><input type="number" min="0" min="0" name="clause_new_unit_price_<?=($key+1)?>_<?=($k+1)?>" value="<?=$v[2]?>"></td>

                                            <td class="<?if($value['clausetype']!=6){echo 'hide';}?>"><input type="number" min="0" name="clause_new_rent_price_<?=($key+1)?>_<?=($k+1)?>" value="<?=$v[3]?>"></td>

                                            <td>
                                                
                                            </td>
                                        </tr>
                                    <?endforeach;?>
                                    <?endif;?>
                                    </tbody>
                                </table>
                            </div>
                            
                        </div>

                        <!-- 说明 -->
                        <div class="form-group">
                            <label class="col-sm-2 control-label">说明：</label>
                            <div class="col-sm-8">
                                <textarea class="form-control" name="clause_note_<?=($key+1)?>" rows="3"><?=$value['note']?></textarea>
                            </div>

                        </div>
                    </div>
                <?endforeach;?>
                <?endif;?>
                </div>


                <!-- 合同附件 -->
                <div class="tab-pane" id="aggrement_account" style="padding: 0 30px">

                    <div class="form-group">
                        <!-- 选择附件 -->
                        <!-- <span class="color-blue " id="upload-file">
                            +附件上传
                        </span>  -->
                    </div>

                    <div class="form-group">

                        <!-- 附件列表 -->
                        <div id="file-container">

                            <?if(isset($contract) && isset($contract['attachmentList']) && is_array($contract['attachmentList'])):?>
                            <?foreach($contract['attachmentList']as $key => $value):?>
                                <div class="file-item">
                                    <img src="<?=HW_IMG?><?= $value['type_img'] ?>" class="icon">
                                    <span class="fileName"><?= $value['file_name'] ?></span>
                                    <input type="hidden" name="attachment[]" value="<?=$value['id']?>">
                                    <?if($value['type'] == 'png' || $value['type'] == 'jpg' || $value['type'] == 'jpeg' || $value['type'] == 'webp' || $value['type'] == 'gif'):?>
                                    <a data-toggle="modal" data-target="#imgModal" data-img="<?=$value['url']?>" class="color-blue preview">预览</a>
                                    <?endif;?>
                                    <a class="opt" href="<?=$value['url']?>">下载</a>
                                    <!-- <a href="#" class="del opt">删除</a> -->
                                </div>
                                <div class="file-item">
                                </div>
                            <?endforeach;?>
                            <?endif;?>
                        </div>

                    </div>

                    <!-- <div class="form-group">
                        <label for="" class="control-label col-sm-2">添加附件</label>
                        <div class="col-sm-3">
                            <div class="add_file add_img1">添加附件</div>
                            <input type="file" name="" id="" style="display: none">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="file" class="col-sm-2  control-label">附件列表</label>
                        <div class="col-sm-3 " id="fileContent">

                            <?php if (isset($contract) && isset($contract['attachmentList']) && is_array($contract['attachmentList'])):
                                foreach ($contract['attachmentList']as $key => $value) { ?>
                                    <div class="file-item">
                                        <img src="<?= $value['type_img'] ?>" class="icon">
                                        <span class="fileName"><?= $value['file_name'] ?></span>
                                        <input type="hidden" name="fileId[]" value="<?= $value['id'] ?>">
                                        <a href="<?= $value['url'] ?>">下载</a>
                                        <a href="#" class="del">删除</a>
                                    </div>
                                    <div class="file-item">
                                    </div>
                                <?php } endif; ?>

                        </div>
                    </div> -->
                </div>

            </div>

        </main>
    </form>

    <!-- 附件上传form表单 -->
    <form id="upload-form" class="hide">
        <input type="file" name="file" id="file-select">
    </form>

    <div class="hide">
        
        <!-- 科目新增模版 -->
        <table>
            <tbody class="table-item—tem">
                <tr>
                    <td>{{num}}</td>
                    <td>
                        <input type="text" class="search_subject" data-type="1">
                        <input type="hidden" name="pre_deposits_new_subject_1_{{num}}">
                        <span class="glyphicon glyphicon-search form-control-feedback"></span>\
                    </td>
                    <td><input type="text" name="pre_deposits_new_getway_1_{{num}}"></td>
                    <td><input type="number" min="0" name="pre_deposits_new_price_1_{{num}}"></td>
                    <td> 
                        

                    </td>
                </tr>
            </tbody>
        </table>


        <!-- 结算周期模版 -->
        <div id="end_cycle_tem">

            <div class="bordered end_cycle_item">
                <div class="opt-del-icon">×</div>
                <!-- <div class="bordered-bottom form-group">
                    <label class="col-sm-2 control-label">结算周期：</label>
                </div> -->
            
                <!-- 名称、出账日类型 -->
                <div class="form-group">
                    <label class="col-sm-2 control-label">名称<span>*</span>：</label>
                    <div class="col-sm-3">
                        <input type="text" class="form-control must" name="cycle_name_{{num}}" required value="">
                    </div>

                    <label class="col-sm-2 control-label">出账日类型：</label>
                    <div class="col-sm-3">
                        <select class="form-control" name="cycle_out_accounts_{{num}}">
                            <option value="0">固定日</option>
                        </select>
                    </div>
                </div>

                <!-- 周期类型、周期月数  -->
                <div class="form-group">
                    <label for="project_name" class="col-sm-2 control-label">周期类型：</label>
                    <div class="col-sm-3">
                        <select class="form-control" name="cycle_type_{{num}}">
                            <option value="0">自然月</option>
                            <option value="1">合同月</option>
                        </select>
                    </div>

                    <label for="project_total_name" class="col-sm-2 control-label">周期月数<span>*</span>：</label>
                    <div class="col-sm-3">
                        <input type="number" min="0" class="form-control" name="cycle_month_{{num}}" required digits min="1" max="12" value="1">
                    </div>
                </div>

                <!-- <div class="form-group bordered-bottom row">
                    <label class="col-sm-2 control-label">周期类型：</label>
                </div> -->

                <!-- 起算日类型  -->
                <div class="form-group">
                    <label for="project_name" class="col-sm-2 control-label">起算日：</label>
                    <div class="col-sm-3">
                        <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="form-control" name="cycle_start_type_{{num}}" value="">
        
                    </div>

                    <!-- <label for="project_name" class="col-sm-2 control-label">起算日<span>*</span>：</label>
                    <div class="col-sm-3">

                        <div class="col-sm-6 clear-padding-left">
                            <input type="number" min="0" class="form-control must" name="cycle_start_month_{{num}}" digist min="0" max="12" required value="">
                        </div>

                        <div class="col-sm-6 clear-padding-right">
                            <input type="number" min="0" class="form-control must" name="cycle_start_days_{{num}}" digist min="0" max="31" required value="">
                        </div>
                    </div> -->
                </div>

                <!-- 说明 -->
                <div class="form-group">
                    <label class="col-sm-2 control-label">说明：</label>
                    <div class="col-sm-8">
                        <textarea class="form-control" name="cycle_note_{{num}}" rows="3"></textarea>
                    </div>

                </div>
            </div>

        </div>


        <!-- 账款条款模版 -->
        <div id="clause_account_tem">

            <div class="bordered clause_account_item">
                <div class="opt-del-icon">×</div>
                
                <input type="hidden" name="clause_clausetype_{{num}}" value="{{clausetype}}">

                <!-- 账款名称 、选中科目-->
                <div class="form-group">
                    <label class="col-sm-2 control-label">账款名称<span>*</span>：</label>
                    <div class="col-sm-3">
                        <input type="text" class="form-control must" name="clause_name_{{num}}" readonly required value="{{text}}">
                    </div>

                    <label for="project_name" class="col-sm-2 control-label">选择科目<span>*</span>：</label>
                    <div class="col-sm-3">
                        <input type="text" class="form-control select_subject search-cont search_cont search_subject" name="select_subject_{{num}}" data-type="0" data-num="{{num}}" readonly required>
                        <input type="hidden" name="clause_subject_{{num}}">
                        <span class="glyphicon glyphicon-search form-control-feedback"></span>

                    </div>
                </div>


                <!-- 账款类型  -->
                <div class="form-group">
                    <label for="project_name" class="col-sm-2 control-label">账款类型<span>*</span>：</label>
                    <div class="col-sm-3 form_text use_way">
                        租金
                    </div>

                    <label for="project_total_name" class="col-sm-2 control-label">收付方向：</label>
                    <div class="col-sm-3">
                        <input type="text" class="form-control pay_tword_{{num}}" readonly>
                        <input type="hidden" name="clause_getpay_{{num}}">
                    </div>
                </div>


                <!-- 开具发票、税收 -->
                <div class="form-group">
                    <label for="project_name" class="col-sm-2 control-label">开具发票：</label>
                    <!-- <div class="col-sm-3">
                        <input type="checkbox" name="_{{num}}">
                    </div> -->

                    <div class="col-sm-3 checkbox">
                        <label>
                            <input type="checkbox" name="clause_invoice_{{num}}" value="1">
                        </label>
                    </div>

                    <label for="project_name" class="col-sm-2 control-label">税收：</label>
                    <div class="col-sm-3">
                        <select class="form-control tax" name="clause_tax_{{num}}">
                            <option value="0">价外税5%</option>
                            <option value="1">价外税6%</option>
                            <option value="2">价外税0%</option>
                            <option value="3">价外税11%</option>
                            <option value="4">价外税13%</option>
                            <option value="5">价内税17%</option>
                            <option value="6">价内税5%</option>
                            <option value="7">价内税6%</option>
                            <option value="8">价内税11%</option>
                            <option value="9">价内税13%</option>
                        </select>
                    </div>
                </div>


                <div class="little_title">结算周期</div>
            
                <!-- 名称、出账日类型 -->
                <div class="form-group">
                    <label class="col-sm-2 control-label">名称<span>*</span>：</label>
                    <div class="col-sm-3">
                        <input type="text" class="form-control must" required name="clause_cyclename_{{num}}" value="">
                    </div>

                    <label class="col-sm-2 control-label">出账日类型：</label>
                    <div class="col-sm-3">
                        <select class="form-control" name="clause_out_accounts_{{num}}">
                            <option value="0">固定日</option>
                        </select>
                    </div>
                </div>

                <!-- 周期类型、周期月数  -->
                <div class="form-group">
                    <label for="project_name" class="col-sm-2 control-label">周期类型：</label>
                    <div class="col-sm-3">
                        <select class="form-control" name="clause_type_{{num}}">
                            <option value="0">自然月</option>
                            <option value="1">合同月</option>
                        </select>
                    </div>

                    <label for="project_total_name" class="col-sm-2 control-label">周期月数<span>*</span>：</label>
                    <div class="col-sm-3">
                        <input type="number" min="0" class="form-control" name="clause_month_{{num}}" required digist min="1" max="12" value="1">
                    </div>
                </div>

                <!-- <div class="row">
                    <label class="col-sm-2 control-label">最后缴款日期</label>
                </div><hr> -->

                <!-- 起算日类型  -->
                <div class="form-group">
                    <label for="project_name" class="col-sm-2 control-label">起算日：</label>
                    <div class="col-sm-3">
                        <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="form-control" name="clause_start_type_{{num}}" value="">

                        <!-- <select class="form-control must" name="clause_start_type_{{num}}" required>
                            <option value="0">账单出账日</option>
                        </select> -->
                    </div>

                    <!-- <label for="project_name" class="col-sm-2 control-label">起算日<span>*</span>：</label>
                    <div class="col-sm-3 clearFixed">
                        <div class="col-sm-6">
                            <input type="number" min="0" class="form-control must" name="clause_start_month_{{num}}" required digist min="0" max="12" value="">
                        </div>
                        <div class="col-sm-6">
                            <input type="number" min="0" class="form-control must" name="clause_start_days_{{num}}" required digist min="0" max="31" value="">
                        </div>
                    </div> -->
                </div>


                <!-- 日固定金额  -->
                <div class="form-group hide">
                    <label for="project_name" class="col-sm-2 control-label">日固定金额<span>*</span>：</label>
                    <div class="radio form-radio">
                        <label>
                            <input type="radio" class="must" name="clause_day_type_{{num}}" value="0" required checked> 按日计算
                        </label>
                    </div>
                   
                    <div class="radio form-radio"">
                        <label>
                            <input type="radio" class="must" name="clause_day_type_{{num}}"  value="1" required> 按年计算
                        </label>
                    </div>
                </div>


               <div class="form-group">
                    <label class="col-sm-2 control-label">账款新增：</label>

                    <div class="col-sm-10">
                        <table class="table table-bordered">
                            <thead>
                                <tr>
                                    <th class="col-4">行号</th>
                                    <th class="col-10">起始日期</th>
                                    <th class="col-10">截止日期</th>
                                    <th class="col-10">{{price_way}}</th>
                                    <!--固定租金-->
                                    <th class="col-5 {{hide}}">固定租金</th>
                                    <th> </th>                
                                </tr>
                            </thead>

                            <tbody class="clause_tr_tem">
                                <tr>
                                    <td>{{tr_num}}</td>
                                    <td><input required type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="clause_new_start_time_{{num}}_{{tr_num}}"></td>
                                    <td><input required type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="clause_new_end_time_{{num}}_{{tr_num}}"></td>
                                    <td><input required type="number" min="0" min="0" name="clause_new_unit_price_{{num}}_{{tr_num}}"></td>
                                    <td class="{{hide}}"><input type="number" min="0" name="clause_new_rent_price_{{num}}_{{tr_num}}" value="0"></td>
                                    <td>
                                        
                                        
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    
                </div>

                <!-- 说明 -->
                <div class="form-group">
                    <label class="col-sm-2 control-label">说明：</label>
                    <div class="col-sm-8">
                        <textarea class="form-control" name="clause_note_{{num}}" rows="3"></textarea>
                    </div>

                </div>
            </div>

        </div>
    </div>




    <!-- 搜索科目模态框 -->
    <div class="modal fade" id="subjectModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">科目搜索</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-sm-6" style="padding-left: 15px">
                            <div class="input-group">
                                <input type="text" class="form-control" placeholder="">
                                <span class="input-group-btn">
                                    <button class="btn btn-default search-btn" type="button">搜索</button>
                                </span>
                            </div><!-- /input-group -->
                        </div>
                    </div>
                    <div class="table-container">
                        <table class="table table-bordered" id="business_type_table">
                            <thead>
                                <tr>
                                    <th class="col-2">选择</th>
                                    <th class="col-5">科目代码</th>
                                    <th class="col-10">科目名称</th>
                                    <th></th>
                                </tr>
                            </thead>

                            <tbody id="subjectTbody">
                                
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary select_subject_btn">确定</button>
                </div>
            </div>
        </div>
    </div>


    <!-- 商户搜索模态框 -->
    <div class="modal fade" id="businessModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">商户搜索</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-sm-6" style="padding-left: 15px">
                            <div class="input-group">
                                <input type="text" class="form-control" placeholder="">
                                <span class="input-group-btn">
                                    <button class="btn btn-default search-btn" type="button">搜索</button>
                                </span>
                            </div><!-- /input-group -->
                        </div>
                    </div>
                    <div class="table-container">
                        <table class="table table-bordered">
                        
                            <thead>
                                <tr>
                                    <th class="col-2">选择</th>
                                    <th class="col-10">商户名称</th>
                                    <th class="col-8">简称</th>
                                    <th class="col-5">外文名称</th>
                                    <th class="col-5">外文简称</th>
                                    <th></th>
                                </tr>
                            </thead>

                            <tbody id="business-tbody">
                                
                            </tbody>
                        </table>
                    </div>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" id="business-confirm">确定</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 业态搜索模态框 -->
    <div class="modal fade" id="formatModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">业态搜索</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-sm-6" style="padding-left: 15px">
                            <div class="input-group">
                                <input type="text" class="form-control" placeholder="">
                                <span class="input-group-btn">
                                    <button class="btn btn-default search-btn" type="button">搜索</button>
                                </span>
                            </div><!-- /input-group -->
                        </div>
                    </div>
                    <div class="table-container">
                        <table class="table table-bordered">
                            <thead>
                                <tr>
                                    <th class="col-2">选择</th>
                                    <th class="col-5">业态代码</th>
                                    <th class="col-10">业态名称</th>
                                    <th></th>
                                </tr>
                            </thead>

                            <tbody id="format-tbody"></tbody>
                        </table>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" id="format-confirm">确定</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 铺位搜索模态框 -->
    <div class="modal fade" id="bunkModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">铺位搜索</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-sm-6" style="padding-left: 15px">
                            <div class="input-group">
                                <input type="text" class="form-control" placeholder="">
                                <span class="input-group-btn">
                                    <button class="btn btn-default search-btn" type="button">搜索</button>
                                </span>
                            </div><!-- /input-group -->
                        </div>
                    </div>
                    <div class="table-container">
                        <table class="table table-bordered" id="bunk_type_table">
                            <thead>
                                <tr>
                                    <th class="col-2">选择</th>
                                    <th class="col-5">铺位代码</th>
                                    <th class="col-10">铺位名称</th>
                                    <th></th>
                                </tr>
                            </thead>

                            <!-- <tbody id="operation_type_tbody">
                                <tr>
                                    <td><input type="radio" name="operation_type_radio"></td>
                                    <td></td>
                                    <td></td>
                                </tr>
                            </tbody> -->
                        </table>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary bunk_type_btn">确定</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 品牌搜索模态框 -->
    <div class="modal fade" id="brandModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">品牌搜索</h4>
                </div>
                <div class="modal-body">

                    <div class="row">
                        <div class="col-sm-6" style="padding-left: 15px">
                            <div class="input-group">
                                <input type="text" class="form-control" placeholder="">
                                <span class="input-group-btn">
                                    <button class="btn btn-default search-btn" type="button">搜索</button>
                                </span>
                            </div><!-- /input-group -->
                        </div>
                    </div>
                    <div class="table-container">
                        <table class="table table-bordered" id="brand_type_table">
                        
                            <thead>
                                <tr>
                                    <th class="col-2">选择</th>
                                    <!-- <th>业态代码</th> -->
                                    <th class="col-10">品牌名称</th>
                                    <th class="col-5">英文名称</th>
                                    <th></th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary brand_type_btn">确定</button>
                </div>
            </div>
        </div>
    </div>

    <!-- Modal -->
    <div class="modal fade" id="imgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">图片预览</h4>
                </div>
                <div class="modal-body">
                    <img class="preview-img" src="" alt="预览图片">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 场地搜索模态框 -->
    <div class="modal fade" id="placeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">场地搜索</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-sm-6" style="padding-left: 15px">
                            <div class="input-group">
                                <input type="text" class="form-control" placeholder="">
                                <span class="input-group-btn">
                                    <button class="btn btn-default search-btn" type="button" data-type="1">搜索</button>
                                </span>
                            </div><!-- /input-group -->
                        </div>
                    </div>
                    <div class="table-container">
                        <table class="table table-bordered" id="place_table">
                            <thead>
                                <tr>
                                    <th class="col-2">选择</th>
                                    <th class="col-5">场地编码</th>
                                    <th class="col-10">场地名称</th>
                                    <th class="col-4">场地面积</th>
                                    <th class="col-4">场地材质</th>
                                    <th class="col-10">场地位置</th>
                                    <th></th>
                                </tr>
                            </thead>
                        
                            <tbody id="place-tbody"></tbody>
                        </table>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary operation_type_btn" id="place-confirm">确定</button>
                </div>
            </div>
        </div>
    </div>


    <div class="loading">
        <!-- <div class="tip"> -->
            <img class="tip" src="<?=HW_IMG?>loading.gif">
        <!-- </div> -->
    </div>

    <script src="<?=HW_STA?>lib/require.js" data-main="<?=HW_PLAN?>planContract/seeContract"></script>
</body>
</html>